package jsu.yym.tiktok.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import jsu.yym.tiktok.pojo.Like;
import jsu.yym.tiktok.pojo.User;
import jsu.yym.tiktok.pojo.UserData;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.repository.query.Param;

import java.util.List;

@Mapper
public interface UserDataMapper extends BaseMapper<UserData> {
    @Select("select * from user_data where username = #{username}")
    List<UserData> getUserData(String username);

    @Select("select video_id from user_data where username = #{username}")
    List<Integer> getUserDataByIds(String username);


    @Select("select * from user_data where username = #{username} and video_id = #{video_id}")
    UserData getUserDataByNameAndID(String username,int video_id);

    @Insert("INSERT INTO user_data (username, video_id) VALUES (#{username}, #{video_id})")
    void insertUserData(UserData userData);
}
